#!/bin/sh
mount -o remount,rw /
# Get Application Install Directory
if (cat /etc/palm/luna.conf | grep -i "/media/cryptofs/apps") ; then
	INSTDIR=/media/cryptofs/apps
else
	INSTDIR=/var
    echo "can't install on this ROM"
    exit 0
fi

ORIDIR=/var/home/root/.justinput/
mkdir -p $ORIDIR

# a fully hack of framework
if [ -f "/usr/palm/frameworks/mojo/builtins/palmInitFramework338.js" ]; then
    mv -f $INSTDIR/usr/palm/applications/com.youjf.justinput/service/palmInitFramework338.ori.js $ORIDIR
    mv -f $INSTDIR/usr/palm/applications/com.youjf.justinput/service/palmInitFramework338.js /usr/palm/frameworks/mojo/builtins/
fi

if [ -f "/usr/palm/frameworks/mojo/builtins/palmInitFramework347.js" ]; then
    mv -f $INSTDIR/usr/palm/applications/com.youjf.justinput/service/palmInitFramework347.ori.js $ORIDIR
    mv -f $INSTDIR/usr/palm/applications/com.youjf.justinput/service/palmInitFramework347.js /usr/palm/frameworks/mojo/builtins/
fi

rm -rf $INSTDIR/usr/palm/applications/com.youjf.justinput/service/

exit 0
